HOME_ROOT="scripts_tools"
this=$(basename "$0")
SCRIPT_VERSION=v1.0.0
# colors
RED="\033[0;31m"
YELLOW="\033[1;33m"
GREEN="\033[0;32m"
NO_COLOR="\033[0m"
BOLD="\033[1m"
UNDERLINE="\033[4m"

die() {
	echo -e "${RED}${@}${NO_COLOR}"
	exit 1
}

warn() {
	echo -e "${YELLOW}${@}${NO_COLOR}"
}

good() {
	echo -e "${GREEN}${@}${NO_COLOR}"
}

printHelp(){
printf "Help:
EXAMPLE: 
\t${this} filename commit-msg 需要提交的脚本文件和commit信息

EXAMPLE: 
\t${this} filename commit-msg


版本号:${SCRIPT_VERSION}
"
exit 1


}

if [ $# -lt 2 ];then
	printHelp
fi

filename=$1
destname=${filename%.*}
commit=$2
test -f $filename || die "please give me filename"

#执行加密脚本操作
mkdir -p release/
cp -rf $filename release/${destname}
gzexe release/${destname}
test -f release/${destname}~ && rm -rf release/${destname}~

#备份提交到60
~/workspace/shell/autoftp/autoftp.sh --ftp put release/${destname} ${HOME_ROOT}/${destname}

#提交脚本到80
cp -rfv release/${destname} /home/user/workspace/shell/git-gerrit/bin
cd /home/user/workspace/shell/git-gerrit/bin
git add ${destname}
git commit -m "${commit}"
git lg  -10 .
read -p "是否上传[enter/ctrl+c]:"
git push 
cd -
